﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MethodWorx.Core.DomainModel;
using MethodWorx.CMS.Configuration;
using MethodWorx.CMS.Plugins;
using MethodWorx.CMS.Content;
using MethodWorx.Core.Validation;


namespace MethodWorx.CMS.Services
{
    public interface IContentService
    {
        Page CreateRootPage(string name, string description, PageTemplate pageTemplate);
        Page GetRootPage();
        Page GetPageById(Guid id);
        ContentItem UpdateContentItemProperties(Guid id, IEnumerable<IPropertyDetails> propertyDetails);
        ContentItem UpdateContentItemProperties(Guid id, IDictionary<string, ICustomPropertyDetails> propertyDetails);
        Page UpdatePageProperties(Guid id, IEnumerable<IPropertyDetails> propertyDetails);
        IEnumerable<Page> GetAllPages();
        void DeletePage(Page page);
        void DeleteContentItem(ContentItem contentItem);
        void ResequenceContent(Page page, ContentItem item, bool up);

        /// <summary>
        /// Create a content item
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="templateName"></param>
        /// <param name="name"></param>
        /// <param name="autoIncrement"></param>
        /// <returns></returns>
        ContentItem CreateContentItem(Page parent, string templateName, string name, bool autoIncrement);
        /// <summary>
        /// Create a content item
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="template"></param>
        /// <param name="name"></param>
        /// <param name="autoIncrement"></param>
        /// <returns></returns>
        ContentItem CreateContentItem(Page parent, ContentTemplate template, string name, bool autoIncrement);
        ContentItem GetContentItemById(Guid contentItemId);


        Page PublishPage(Guid id);


        /// <summary>
        /// Publish content by Id
        /// </summary>
        /// <param name="id"></param>
        IEnumerable<Page> PublishPages(Guid[] ids);


        void PublishContentItem(ContentItem item);


     


        IEnumerable<Page> GetPagesByTags(string p);


        IEnumerable<ContentItem> GetAllConentItems();


        IEnumerable<ContentItem> GetContentItemsByTags(string p);


        IEnumerable<ContentItem> GetContentByTemplate(Page parentPage, string template, string orderBy,
                                                      string orderDirection, int? maximum, bool preview,
                                                      ContentQueryOptions options);

        IEnumerable<Page> GetPagesByTemplate(string template);


        void RenameContentItem(ContentItem contentItem, string newName);
    }
}
